using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace TimeWar
{
    public sealed class CM
    {

        private static volatile CM instance;
        private static Object lockObject = new Object();

        private static ContentManager contentMgr = null;

        private CM()
        {
            //contentMgr = new ContentManager(serviceProvider, "Content");
        }

        public static CM Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (lockObject)
                    {
                        if (instance == null)
                            instance = new CM();
                    }
                }

                return instance;
            }

        }

        public static void initialize(IServiceProvider serviceProvider)
        {
            contentMgr = new ContentManager(serviceProvider, "Content");
        }

        public static Model loadModel(String modelLocation)
        {
            return contentMgr.Load<Model>(modelLocation);
        }

        public static Texture2D loadTexture(String textureLocaton)
        {
            return contentMgr.Load<Texture2D>(textureLocaton);
        }

        public static SpriteFont loadFont(String fontLocation)
        {
            return contentMgr.Load<SpriteFont>(fontLocation);
        }

        public static Effect loadEffect(String assetName)
        {
            return contentMgr.Load<Effect>(assetName);
        }

    }

}